package com.wxy.common.utils;

import lombok.Data;

@Data
public class ResultUtil {

    private Boolean success;

    private String msg;

    private Object data;

    private Integer total;

    public static ResultUtil success(Object data) {
        ResultUtil resultUtil = new ResultUtil();
        resultUtil.setSuccess(true);
        resultUtil.setData(data);
        return resultUtil;
    }

    public static ResultUtil success(Object data, Integer total) {
        ResultUtil resultUtil = new ResultUtil();
        resultUtil.setSuccess(true);
        resultUtil.setTotal(total);
        resultUtil.setData(data);
        return resultUtil;
    }

    public static ResultUtil success() {
        ResultUtil resultUtil = new ResultUtil();
        resultUtil.setSuccess(true);
        return resultUtil;
    }

    public static ResultUtil error(String msg) {
        ResultUtil resultUtil = new ResultUtil();
        resultUtil.setSuccess(false);
        resultUtil.setMsg(msg);
        return resultUtil;
    }
}
